package com.changgou.goods.feign;

import com.changgou.entity.Result;
import com.changgou.goods.pojo.Category;
import com.changgou.goods.pojo.Sku;
import com.changgou.goods.pojo.Spu;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lqq
 * @date 2020-03-01 22:50
 */
@FeignClient(name = "goods")
public interface SkuFeign {
    @GetMapping("/sku/spu/{spuId}")
    public List<Sku> findSkuListSpuId(@PathVariable("spuId") String spuId);


    @GetMapping("/category/{id}")
    public Result<Category> findById(@PathVariable("id") Integer id);

    @GetMapping("/spu/findSpuById/{id}")
    public Result<Spu> findSpuById(@PathVariable("id") String id);

    @GetMapping("/sku/{id}")
    public Result<Sku> findById(@PathVariable("id") String id);


    @PostMapping("/sku/decr/count")
    public Result decrCount(@RequestParam("username") String username);

    //回滚库存
    @RequestMapping("/sku/resumeStockNum")
    public Result resumeStockNum(@RequestParam("skuId") String skuId, @RequestParam("num") Integer num);

}
